package com.ypd.shop.service.impl;

import java.util.List;

import com.ypd.common.utils.SecurityUtils;
import com.ypd.shop.domain.AuctionItem;
import com.ypd.shop.domain.vo.EnrollVo;
import com.ypd.shop.service.IAuctionItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ypd.shop.mapper.AuctionEnrollmentMapper;
import com.ypd.shop.domain.AuctionEnrollment;
import com.ypd.shop.service.IAuctionEnrollmentService;

/**
 * 拍卖报名记录Service业务层处理
 * 
 * @author lin
 * @date 2025-03-02
 */
@Service
public class AuctionEnrollmentServiceImpl implements IAuctionEnrollmentService 
{
    @Autowired
    private AuctionEnrollmentMapper auctionEnrollmentMapper;
    @Autowired
    private IAuctionItemService auctionItemService;

    /**
     * 查询拍卖报名记录
     * 
     * @param id 拍卖报名记录主键
     * @return 拍卖报名记录
     */
    @Override
    public AuctionEnrollment selectAuctionEnrollmentById(String id)
    {
        return auctionEnrollmentMapper.selectAuctionEnrollmentById(id);
    }

    /**
     * 查询拍卖报名记录列表
     * 
     * @param auctionEnrollment 拍卖报名记录
     * @return 拍卖报名记录
     */
    @Override
    public List<AuctionEnrollment> selectAuctionEnrollmentList(AuctionEnrollment auctionEnrollment)
    {
        return auctionEnrollmentMapper.selectAuctionEnrollmentList(auctionEnrollment);
    }

    /**
     * 查询我的拍卖报名记录列表
     *
     * @param auctionEnrollment 拍卖报名记录
     * @return 拍卖报名记录
     */
    @Override
    public List<EnrollVo> selectAuctionEnrollmentMyList(AuctionEnrollment auctionEnrollment)
    {
        auctionEnrollment.setUserId(String.valueOf(SecurityUtils.getUserId()));
        //算了,直接xml进行联表查询
        return auctionEnrollmentMapper.selectAuctionMyEnrollmentList(auctionEnrollment);
    }

    /**
     * 新增拍卖报名记录
     * 
     * @param auctionEnrollment 拍卖报名记录
     * @return 结果
     */
    @Override
    public int insertAuctionEnrollment(AuctionEnrollment auctionEnrollment)
    {
        auctionEnrollment.setUserId(String.valueOf(SecurityUtils.getUserId()));
        return auctionEnrollmentMapper.insertAuctionEnrollment(auctionEnrollment);
    }

    /**
     * 修改拍卖报名记录
     * 
     * @param auctionEnrollment 拍卖报名记录
     * @return 结果
     */
    @Override
    public int updateAuctionEnrollment(AuctionEnrollment auctionEnrollment)
    {
        return auctionEnrollmentMapper.updateAuctionEnrollment(auctionEnrollment);
    }

    /**
     * 批量删除拍卖报名记录
     * 
     * @param ids 需要删除的拍卖报名记录主键
     * @return 结果
     */
    @Override
    public int deleteAuctionEnrollmentByIds(String[] ids)
    {
        return auctionEnrollmentMapper.deleteAuctionEnrollmentByIds(ids);
    }

    /**
     * 删除拍卖报名记录信息
     * 
     * @param id 拍卖报名记录主键
     * @return 结果
     */
    @Override
    public int deleteAuctionEnrollmentById(String id)
    {
        return auctionEnrollmentMapper.deleteAuctionEnrollmentById(id);
    }
}
